<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"lianyouli.gitee.io","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="hive3安装过程和一些安装问题处理">
<meta property="og:type" content="article">
<meta property="og:title" content="hive3 安装">
<meta property="og:url" content="https://lianyouli.gitee.io/IT/it-bigdata-hive-installation/index.html">
<meta property="og:site_name" content="联友的Blog">
<meta property="og:description" content="hive3安装过程和一些安装问题处理">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2022-05-07T13:54:14.000Z">
<meta property="article:modified_time" content="2022-05-08T14:03:20.724Z">
<meta property="article:author" content="李联友">
<meta property="article:tag" content="bigdata">
<meta property="article:tag" content="hive">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://lianyouli.gitee.io/IT/it-bigdata-hive-installation/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>hive3 安装 | 联友的Blog</title>
  


  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?eb9f10e46b1f09801805fc668f13d477";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="联友的Blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">联友的Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">密涅瓦的猫头鹰在黄昏起飞</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">25</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">8</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">31</span></a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://lianyouli.gitee.io/IT/it-bigdata-hive-installation/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/header.jpg">
      <meta itemprop="name" content="李联友">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="联友的Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hive3 安装
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-05-07 21:54:14" itemprop="dateCreated datePublished" datetime="2022-05-07T21:54:14+08:00">2022-05-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-05-08 22:03:20" itemprop="dateModified" datetime="2022-05-08T22:03:20+08:00">2022-05-08</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/IT/" itemprop="url" rel="index"><span itemprop="name">IT</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <blockquote>
<p>hive3安装过程和一些安装问题处理</p>
</blockquote>
<a id="more"></a>

<h2 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h2><ul>
<li>MacOS Monterey</li>
<li>Oracle JDK 1.8.0_181</li>
<li>Hadoop-3.3.1</li>
<li>Hive 3.1.3</li>
<li>MySQL 8.0.28 </li>
</ul>
<h2 id="官网"><a href="#官网" class="headerlink" title="官网"></a>官网</h2><p><a href="https://cwiki.apache.org/confluence/display/Hive//LanguageManual" target="_blank" rel="noopener">LanguageManual - Apache Hive - Apache Software Foundation</a></p>
<h2 id="下载"><a href="#下载" class="headerlink" title="下载"></a>下载</h2><p><a href="https://dlcdn.apache.org/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz" target="_blank" rel="noopener">https://dlcdn.apache.org/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz</a></p>
<h2 id="安装-amp-配置"><a href="#安装-amp-配置" class="headerlink" title="安装 &amp; 配置"></a>安装 &amp; 配置</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf apache-hive-3.1.3-bin.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 我做了一个软链接</span></span><br><span class="line">ln -s apache-hive-3.1.3-bin hive3</span><br></pre></td></tr></table></figure>

<h3 id="创建MySQL账户-amp-DB"><a href="#创建MySQL账户-amp-DB" class="headerlink" title="创建MySQL账户 &amp; DB"></a>创建MySQL账户 &amp; DB</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> <span class="keyword">DATABASE</span> <span class="string">`hive313`</span> <span class="comment">/*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */</span> <span class="comment">/*!80016 DEFAULT ENCRYPTION='N' */</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> hive <span class="keyword">identified</span> <span class="keyword">with</span> mysql_native_password <span class="keyword">by</span> <span class="string">'Awesome@123'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">privileges</span> <span class="keyword">on</span> hive313.* <span class="keyword">to</span> hive;</span><br></pre></td></tr></table></figure>

<h3 id="hive-site-xml"><a href="#hive-site-xml" class="headerlink" title="hive-site.xml"></a>hive-site.xml</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> hive3/conf</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建hive的配置文件</span></span><br><span class="line">cp hive-default.xml.template hive-site.xml</span><br></pre></td></tr></table></figure>

<h4 id="db"><a href="#db" class="headerlink" title="db"></a>db</h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.metastore.db.type<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>mysql<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span></span><br><span class="line">    Expects one of [derby, oracle, mysql, mssql, postgres].</span><br><span class="line">    Type of database used by the metastore. Information schema <span class="symbol">&amp;amp;</span> JDBCStorageHandler depend on it.</span><br><span class="line">  <span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>javax.jdo.option.ConnectionURL<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>jdbc:mysql://localhost:3306/hive313?useSSL=false<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span></span><br><span class="line">    JDBC connect string for a JDBC metastore.</span><br><span class="line">    To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.</span><br><span class="line">    For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.</span><br><span class="line">  <span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>javax.jdo.option.ConnectionUserName<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>hive<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>Username to use against metastore database<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>javax.jdo.option.ConnectionPassword<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>Awesome@123<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>password to use against metastore database<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h4 id="hive-metastore"><a href="#hive-metastore" class="headerlink" title="hive metastore"></a>hive metastore</h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.metastore.uris<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>thrift://localhost:9083<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h4 id="hive-server2"><a href="#hive-server2" class="headerlink" title="hive server2"></a>hive server2</h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.server2.thrift.bind.host<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>localhost<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>Bind host on which to run the HiveServer2 Thrift service.<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.server2.transport.mode<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>binary<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span></span><br><span class="line">    Expects one of [binary, http].</span><br><span class="line">    Transport mode of HiveServer2.</span><br><span class="line">  <span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span> </span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.server2.thrift.port<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>10000<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'binary'.<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h4 id="hdfs目录"><a href="#hdfs目录" class="headerlink" title="hdfs目录"></a>hdfs目录</h4><blockquote>
<p>这样设置，将内表和外表都统一在/user/hive/warehouse目录下。</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.metastore.warehouse.dir<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>/user/hive/warehouse/managed<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>location of default database for the warehouse<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.metastore.warehouse.external.dir<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>/user/hive/warehouse/external<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span>Default location for external tables created in the warehouse. If not set or null, then the normal warehouse location will be used as the default location.<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br></pre></td></tr></table></figure>



<h4 id="变量"><a href="#变量" class="headerlink" title="变量"></a>变量</h4><p>默认配置文件中有大量的${system:java.io.tmpdir} 和 ${system:user.name}，在我的电脑上有点问题，所以我全部将这些变量替换成了我自己的设置</p>
<p>${system:java.io.tmpdir}  ==&gt; /Users/arthur/opt/apache/hive3/logs</p>
<p>${system:user.name} ==&gt; arthur</p>
<h4 id="监控设置"><a href="#监控设置" class="headerlink" title="监控设置"></a>监控设置</h4><p>如果要开启hive metastore &amp; hive server2的指标监控，请参考<a href="it-bigdata-hive-simple-query.md">hive查询和监控设置</a></p>
<h3 id="日志配置文件"><a href="#日志配置文件" class="headerlink" title="日志配置文件"></a>日志配置文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$HIVE_HOME</span>/conf</span><br><span class="line">cp hive-log4j2.properties.template hive-log4j2.properties</span><br><span class="line"><span class="comment"># 同变量部分，修改property.hive.log.dir。</span></span><br></pre></td></tr></table></figure>

<p>Beeline 客户端日志配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp beeline-log4j2.properties.template beeline-log4j2.properties</span><br></pre></td></tr></table></figure>



<h2 id="初始化schema"><a href="#初始化schema" class="headerlink" title="初始化schema"></a>初始化schema</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bin/schematool -dbType mysql -initSchema</span><br></pre></td></tr></table></figure>



<h2 id="启动服务"><a href="#启动服务" class="headerlink" title="启动服务"></a>启动服务</h2><h3 id="metastore"><a href="#metastore" class="headerlink" title="metastore"></a>metastore</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bin/hive --service metastore  &amp;</span><br></pre></td></tr></table></figure>

<h3 id="Hive-server2"><a href="#Hive-server2" class="headerlink" title="Hive server2"></a>Hive server2</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bin&#x2F;hive --service hiveserver2  &amp;</span><br></pre></td></tr></table></figure>



<h2 id="客户端"><a href="#客户端" class="headerlink" title="客户端"></a>客户端</h2><h3 id="beeline"><a href="#beeline" class="headerlink" title="beeline"></a>beeline</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bin/beeline -u jdbc:hive2://localhost:10000 -n <span class="string">"arthur"</span> -p <span class="string">""</span></span><br></pre></td></tr></table></figure>

<h3 id="dbeaver"><a href="#dbeaver" class="headerlink" title="dbeaver"></a>dbeaver</h3><p>我这个社区22.0.0版本的有点不太友好，特别是在insert into这种语句时，会有问题，同时sql支持有点差。</p>
<h2 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h2><ul>
<li><p>hive.txn.xlock.iow注释问题</p>
<blockquote>
<p> 删除 &amp;#8;</p>
<p>下面是的配置是正确的</p>
</blockquote>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">name</span>&gt;</span>hive.txn.xlock.iow<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">value</span>&gt;</span>true<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">description</span>&gt;</span></span><br><span class="line">    Ensures commands with OVERWRITE (such as INSERT OVERWRITE) acquire Exclusive locks for transactional tables.  This ensures that inserts (w/o overwrite) running concurrently</span><br><span class="line">    are not hidden by the INSERT OVERWRITE.</span><br><span class="line">  <span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br></pre></td></tr></table></figure>



</li>
</ul>
<ul>
<li><p>cannot recognize input near ‘SHOW’ ‘INDEX’ ‘ON’ in ddl statement</p>
<blockquote>
<p>在执行select语句时，hive后台日志报错，具体的错误日志如下，</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"> &gt;-- a. 后台日志报错</span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> dumy;</span><br><span class="line"><span class="comment">-- b. 后台无报错</span></span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> default.dumy;</span><br><span class="line"><span class="comment">-- c. 后台无报错</span></span><br><span class="line"><span class="keyword">use</span> <span class="keyword">default</span>;</span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> dumy;</span><br></pre></td></tr></table></figure>

</blockquote>
<p>原因</p>
<blockquote>
<p>经过测试，导致此问题的原因有可能是没有指定default数据库。</p>
</blockquote>
</li>
</ul>
<pre><code>报错日志

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">022</span>-<span class="number">05</span>-<span class="number">07</span>T21:<span class="number">52</span>:<span class="number">18</span>,<span class="number">858</span>  WARN [HiveServer2-Handler-Pool: Thread-<span class="number">56</span>] thrift.ThriftCLIService: Error executing statement: </span><br><span class="line">org.apache.hive.service.cli.HiveSQLException: Error <span class="keyword">while</span> compiling statement: FAILED: ParseException line <span class="number">1</span>:<span class="number">5</span> cannot recognize input near <span class="string">'SHOW'</span> <span class="string">'INDEX'</span> <span class="string">'ON'</span> in ddl statement</span><br><span class="line">at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:<span class="number">335</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:<span class="number">199</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:<span class="number">260</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.operation.Operation.run(Operation.java:<span class="number">247</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:<span class="number">541</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:<span class="number">527</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:<span class="number">62</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:<span class="number">43</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at java.lang.reflect.Method.invoke(Method.java:<span class="number">498</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:<span class="number">78</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionProxy.access$<span class="number">000</span>(HiveSessionProxy.java:<span class="number">36</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionProxy$<span class="number">1</span>.run(HiveSessionProxy.java:<span class="number">63</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at java.security.AccessController.doPrivileged(Native Method) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at javax.security.auth.Subject.doAs(Subject.java:<span class="number">422</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:<span class="number">1878</span>) ~[hadoop-common-<span class="number">3.3</span><span class="number">.1</span>.jar:?]</span><br><span class="line">at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:<span class="number">59</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at com.sun.proxy.$Proxy37.executeStatementAsync(Unknown Source) ~[?:?]</span><br><span class="line">at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:<span class="number">312</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:<span class="number">562</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:<span class="number">1557</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:<span class="number">1542</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:<span class="number">39</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:<span class="number">39</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:<span class="number">56</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:<span class="number">286</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:<span class="number">1149</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:<span class="number">624</span>) ~[?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">at java.lang.Thread.run(Thread.java:<span class="number">748</span>) [?:<span class="number">1.8</span><span class="number">.0_181</span>]</span><br><span class="line">Caused by: org.apache.hadoop.hive.ql.parse.ParseException: line <span class="number">1</span>:<span class="number">5</span> cannot recognize input near <span class="string">'SHOW'</span> <span class="string">'INDEX'</span> <span class="string">'ON'</span> in ddl statement</span><br><span class="line">at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:<span class="number">223</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:<span class="number">74</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:<span class="number">67</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:<span class="number">616</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:<span class="number">1826</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:<span class="number">1773</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:<span class="number">1768</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:<span class="number">126</span>) ~[hive-exec-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:<span class="number">197</span>) ~[hive-service-<span class="number">3.1</span><span class="number">.3</span>.jar:<span class="number">3.1</span><span class="number">.3</span>]</span><br><span class="line">... <span class="number">27</span> more</span><br></pre></td></tr></table></figure></code></pre><ul>
<li><p>Count(*) 不报错 ，而count(x) 时报错</p>
<blockquote>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- a. 不报错</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">count</span>(*) <span class="keyword">from</span> dumy;</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">+------+</span></span><br><span class="line"><span class="comment">| _c0  |</span></span><br><span class="line"><span class="comment">+------+</span></span><br><span class="line"><span class="comment">| 1    |</span></span><br><span class="line"><span class="comment">+------+</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- b. 报错, 报错信息如下</span></span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> dumy;</span><br></pre></td></tr></table></figure>
</blockquote>
<p>报错日志</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">Error: Error <span class="keyword">while</span> processing statement: FAILED: Execution Error, <span class="keyword">return</span> code <span class="number">1</span> from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. Permission denied: user=anonymous, access=EXECUTE, inode=<span class="string">"/tmp/hadoop-yarn"</span>:arthur:supergroup:drwx------</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:<span class="number">504</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(FSPermissionChecker.java:<span class="number">420</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:<span class="number">323</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermissionWithContext(FSPermissionChecker.java:<span class="number">360</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:<span class="number">240</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(FSPermissionChecker.java:<span class="number">711</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkTraverse(FSDirectory.java:<span class="number">1888</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkTraverse(FSDirectory.java:<span class="number">1906</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSDirectory.resolvePath(FSDirectory.java:<span class="number">727</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.getFileInfo(FSDirStatAndListingOp.java:<span class="number">112</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:<span class="number">3355</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:<span class="number">1219</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:<span class="number">1042</span>)</span><br><span class="line">	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$<span class="number">2</span>.callBlockingMethod(ClientNamenodeProtocolProtos.java)</span><br><span class="line">	at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:<span class="number">600</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:<span class="number">568</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:<span class="number">552</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:<span class="number">1093</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:<span class="number">1035</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:<span class="number">963</span>)</span><br><span class="line">	at java.security.AccessController.doPrivileged(Native Method)</span><br><span class="line">	at javax.security.auth.Subject.doAs(Subject.java:<span class="number">422</span>)</span><br><span class="line">	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:<span class="number">1878</span>)</span><br><span class="line">	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:<span class="number">2966</span>) (state=<span class="number">08</span>S01,code=<span class="number">1</span>)</span><br></pre></td></tr></table></figure>

<p>原因</p>
<blockquote>
<p>不过为啥会一样的原因是因为hive在执行一些统计信息时，是不会真的去执行，而是直接从元数据库里返回。所以count(*)就是直接返回。而有些操作则会调用执行引擎执行任务。</p>
</blockquote>
<p>解决报错问题</p>
<ol>
<li><p>tmp及其子目录赋予权限。 这种不建议</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hdfs dfs -chmod -R 777 /tmp</span><br></pre></td></tr></table></figure>
</li>
<li><p>beeline 登录参数配置好用户名</p>
<p>   默认登录的用户为</p>
   <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- bin/beeline -u jdbc:hive2://localhost:10000</span></span><br><span class="line">0: jdbc:hive2://localhost:10000&gt; select current_user();</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">|    _c0     |</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">| anonymous  |</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>

<p>   加上用户信息</p>
   <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- bin/beeline -u jdbc:hive2://localhost:10000 -n arthur -p ""</span></span><br><span class="line">0: jdbc:hive2://localhost:10000&gt; select current_user();</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">|    _c0     |</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">| arthur     |</span></span><br><span class="line"><span class="comment">+------------+</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>



</li>
</ol>
</li>
</ul>

    </div>

    
    
    
        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/bigdata/" rel="tag"># bigdata</a>
              <a href="/tags/hive/" rel="tag"># hive</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/uncategorized/it-bigdata-distributed-sql-query-engine-trino/" rel="prev" title="初探trino">
      <i class="fa fa-chevron-left"></i> 初探trino
    </a></div>
      <div class="post-nav-item">
    <a href="/IT/it-bigdata-hive-simple-query/" rel="next" title="hive查询和监控设置">
      hive查询和监控设置 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#环境"><span class="nav-number">1.</span> <span class="nav-text">环境</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#官网"><span class="nav-number">2.</span> <span class="nav-text">官网</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#下载"><span class="nav-number">3.</span> <span class="nav-text">下载</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-amp-配置"><span class="nav-number">4.</span> <span class="nav-text">安装 &amp; 配置</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#创建MySQL账户-amp-DB"><span class="nav-number">4.1.</span> <span class="nav-text">创建MySQL账户 &amp; DB</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#hive-site-xml"><span class="nav-number">4.2.</span> <span class="nav-text">hive-site.xml</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#db"><span class="nav-number">4.2.1.</span> <span class="nav-text">db</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#hive-metastore"><span class="nav-number">4.2.2.</span> <span class="nav-text">hive metastore</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#hive-server2"><span class="nav-number">4.2.3.</span> <span class="nav-text">hive server2</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#hdfs目录"><span class="nav-number">4.2.4.</span> <span class="nav-text">hdfs目录</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#变量"><span class="nav-number">4.2.5.</span> <span class="nav-text">变量</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#监控设置"><span class="nav-number">4.2.6.</span> <span class="nav-text">监控设置</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#日志配置文件"><span class="nav-number">4.3.</span> <span class="nav-text">日志配置文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#初始化schema"><span class="nav-number">5.</span> <span class="nav-text">初始化schema</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#启动服务"><span class="nav-number">6.</span> <span class="nav-text">启动服务</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#metastore"><span class="nav-number">6.1.</span> <span class="nav-text">metastore</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hive-server2"><span class="nav-number">6.2.</span> <span class="nav-text">Hive server2</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#客户端"><span class="nav-number">7.</span> <span class="nav-text">客户端</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#beeline"><span class="nav-number">7.1.</span> <span class="nav-text">beeline</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#dbeaver"><span class="nav-number">7.2.</span> <span class="nav-text">dbeaver</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#问题"><span class="nav-number">8.</span> <span class="nav-text">问题</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="李联友"
      src="/images/header.jpg">
  <p class="site-author-name" itemprop="name">李联友</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">31</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/lianyouli" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lianyouli" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">李联友</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

<script src="/js/jquery.min.js"> </script>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>



<script src="/js/code-unfold.js"></script>


  















  

  

</body>
</html>
